package com.jt.service;

import com.jt.service.factory.ProviderFallbackFactory;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;

/**
 * @FeignClient为服务者提供远端服务的名称
 * contextId为了防止后面在多个服务共同调用该远端服务时发生覆盖现象，所以要给接口定义一个代理对象的名称
 */
@FeignClient(name = "sca-provider",contextId = "feignConsumerService",fallbackFactory = ProviderFallbackFactory.class)
public interface FeignConsumerService {
    /**
     * Feign接口基于方法上的@GetMapping等注解的value属性值
     * 后续会基于这个值继续调用远端服务的方法
     * @param msg
     * @return
     */
    @GetMapping("provider/echo/{msg}")
    public String echoFeignMag(@PathVariable("msg") String msg);
}
